package com.wqtz.chechai.view.fragments;

import android.content.Intent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.wqtz.chechai.R;
import com.wqtz.chechai.base.BaseFragment;
import com.wqtz.chechai.bean.ItemType;
import com.wqtz.chechai.bean.RenewData;
import com.wqtz.chechai.presenter.BasePresent;
import com.wqtz.chechai.utils.DensityUtils;
import com.wqtz.chechai.utils.LogUtils;
import com.wqtz.chechai.view.activities.RenewInfomationActivity;

import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;

import java.util.ArrayList;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * 项目名称： CheChai
 * 创建人 :  Kisum
 * 创建时间: 2017/1/20
 * 资料归档界面
 */

public class DataArchiveFragment extends BaseFragment {
    /**
     * 放款的四种状态：审核中 审核成功 被拒绝 取消
     */
    private final int CHECKING = 0;
    private final int CHECK_SUCCESSED = 1;
    private final int REFUSED = 2;
    private final int CANCELD = 3;
    /**
     * 退款的三种状态： 退款审核中 已退款 退款被拒绝
     */
    private final int REFUND_CHECKING = 4;
    private final int REFUND_CHECK_SUCCESSED = 5;
    private final int REFUND_REFUSED = 6;
    /**
     * 解约的三种状态： 解约审核中 已解约 解约被拒绝
     */
    private final int BREAK_CHECKING = 7;
    private final int BREAK_CHECK_SUCCESSED = 8;
    private final int BREAK_REFUSED = 9;
    /**
     * 归档的三种状态： 归档审核中 已归档 归档被拒绝
     */
    private final int FILE_CHECKING = 10;
    private final int FILE_CHECK_SUCCESSED = 11;
    private final int FILE_REFUSED = 12;
    /**
     * 续约的三种状态： 续约审核中 已续约 续约被拒绝
     */
    private final int RENEW_CHECKING = 13;
    private final int RENEW_CHECK_SUCCESSED = 14;
    private final int RENEW_REFUSED = 15;

    //签约资料
    @BindView(R.id.tv_contract_status)
    TextView mTvContractStatus;
    //行驶证信息
    @BindView(R.id.tv_drivelicense_status)
    TextView mTvDrivelicenseStatus;
    //查档
    @BindView(R.id.tv_checkfile_status)
    TextView mTvCheckfileStatus;
    //车辆信息
    @BindView(R.id.tv_carinfo_status)
    TextView mTvCarinfoStatus;
    //联系人信息
    @BindView(R.id.tv_contactpeople_status)
    TextView mTvContactpeopleStatus;
    //平台下款回单
    @BindView(R.id.rl_loaninfo_status)
    RelativeLayout mRlLoaninfoStatus;
    //平台下款回单状态
    @BindView(R.id.tv_loaninfo_status)
    TextView mTvLoaninfoStatus;
    //退款回单
    @BindView(R.id.rl_refund_status)
    RelativeLayout mRlRefundStatus;
    //退款回单状态
    @BindView(R.id.tv_refund_status)
    TextView mTvRefundStatus;
    //放款回单
    @BindView(R.id.rl_loanmoney_status)
    RelativeLayout mRlLoanmoneyStatus;
    //放款回单状态
    @BindView(R.id.tv_loanmoney_status)
    TextView mTvLoanmoneyStatus;
    //解约声明
    @BindView(R.id.rl_break_status)
    RelativeLayout mRlBreakStatus;
    //解约声明状态
    @BindView(R.id.tv_break_status)
    TextView mTvBreakStatus;
    //续约声明
    @BindView(R.id.rl_renewal_status)
    RelativeLayout mRlRenewalStatus;
    //续约声明状态
    @BindView(R.id.tv_renewal_status)
    TextView mTvRenewalStatus;
    //签约资料条目
    @BindView(R.id.rl_contract_info)
    RelativeLayout mRlContractInfo;

    @Override
    public BasePresent createPresenter() {
        return null;
    }

    @Override
    protected int getContentView() {
        return R.layout.fragment_data_archive;
    }

    @Override
    protected void init(View view) {
        ButterKnife.bind(this, view);
        //注册EventBus
        EventBus.getDefault().register(this);
    }

    @Override
    protected void loadDatas() {

    }

    @OnClick({R.id.rl_contract_info})
    public void onClick(View view) {
        switch (view.getId()) {
            //签约资料
            case R.id.rl_contract_info:
                Intent toRenewInfoIntent = new Intent(getActivity(), RenewInfomationActivity.class);
                startActivity(toRenewInfoIntent);
                break;
        }
    }


    //订阅者订阅EventBus事件,在主线程执行
    @Subscribe(threadMode = ThreadMode.MAIN, sticky = true)
    public void receiveImagePath(RenewData renewData) {
        ArrayList<String> imagePath = renewData.getList();
        LogUtils.e("imagePath:" + imagePath);
        if (imagePath.size() != 0) {
            mTvContractStatus.setBackgroundResource(R.drawable.loaninfo_completed);
            mTvContractStatus.setText("");
            ViewGroup.LayoutParams layoutParams = getLayoutParams(mTvContractStatus);
            mTvContractStatus.setLayoutParams(layoutParams);
        } else {
            mTvContractStatus.setText("未完成");
        }

    }

    /**
     * 获取控件宽高
     *
     * @param tvContractStatus
     * @return
     */
    private ViewGroup.LayoutParams getLayoutParams(TextView tvContractStatus) {
        ViewGroup.LayoutParams layoutParams = tvContractStatus.getLayoutParams();
        layoutParams.height = DensityUtils.dp2px(getContext(), 20);
        layoutParams.width = DensityUtils.dp2px(getContext(), 20);
        return layoutParams;
    }

    //订阅者订阅EventBus事件,注册为粘性事件
    @Subscribe(threadMode = ThreadMode.MAIN, sticky = true)
    public void checkInfoStatus(ItemType itemType) {
        int mType = itemType.getType();
        switch (mType) {
            /**
             * 放款的四种状态：审核中 审核成功 被拒绝 取消
             */
            case CHECKING:
                LogUtils.e("type:" + mType);
                mTvDrivelicenseStatus.setBackgroundResource(R.drawable.loaninfo_completed);
                mTvDrivelicenseStatus.setText("");
                mTvDrivelicenseStatus.setLayoutParams(getLayoutParams(mTvDrivelicenseStatus));

                mTvCheckfileStatus.setBackgroundResource(R.drawable.loaninfo_completed);
                mTvCheckfileStatus.setText("");
                mTvCheckfileStatus.setLayoutParams(getLayoutParams(mTvCheckfileStatus));

                mTvCarinfoStatus.setText("未完成");
                mTvContactpeopleStatus.setText("未完成");
                break;
            case CHECK_SUCCESSED:
                LogUtils.e("type:" + mType);
                mTvDrivelicenseStatus.setBackgroundResource(R.drawable.loaninfo_completed);
                mTvDrivelicenseStatus.setText("");
                mTvDrivelicenseStatus.setLayoutParams(getLayoutParams(mTvDrivelicenseStatus));

                mTvCheckfileStatus.setBackgroundResource(R.drawable.loaninfo_completed);
                mTvCheckfileStatus.setText("");
                mTvCheckfileStatus.setLayoutParams(getLayoutParams(mTvCheckfileStatus));

                mTvCarinfoStatus.setText("未完成");
                mTvContactpeopleStatus.setText("未完成");
                //平台下款回单
                mRlLoaninfoStatus.setVisibility(View.VISIBLE);
                mTvLoaninfoStatus.setText("未完成");
                break;
            case REFUSED:
                LogUtils.e("type:" + mType);
                mTvDrivelicenseStatus.setBackgroundResource(R.drawable.loaninfo_completed);
                mTvDrivelicenseStatus.setText("");
                mTvDrivelicenseStatus.setLayoutParams(getLayoutParams(mTvDrivelicenseStatus));

                mTvCheckfileStatus.setBackgroundResource(R.drawable.loaninfo_completed);
                mTvCheckfileStatus.setText("");
                mTvCheckfileStatus.setLayoutParams(getLayoutParams(mTvCheckfileStatus));
                mTvCarinfoStatus.setText("未完成");
                mTvContactpeopleStatus.setText("未完成");
                break;
            case CANCELD:
                LogUtils.e("type:" + mType);
                mTvDrivelicenseStatus.setBackgroundResource(R.drawable.loaninfo_completed);
                mTvDrivelicenseStatus.setText("");
                mTvDrivelicenseStatus.setLayoutParams(getLayoutParams(mTvDrivelicenseStatus));

                mTvCheckfileStatus.setBackgroundResource(R.drawable.loaninfo_completed);
                mTvCheckfileStatus.setText("");
                mTvCheckfileStatus.setLayoutParams(getLayoutParams(mTvCheckfileStatus));
                mTvCarinfoStatus.setText("未完成");
                mTvContactpeopleStatus.setText("未完成");
                break;
            /**
             * 退款的三种状态： 退款审核中 已退款 退款被拒绝
             */
            case REFUND_CHECKING:
                LogUtils.e("type:" + mType);
                mTvDrivelicenseStatus.setBackgroundResource(R.drawable.loan_locked);
                mTvDrivelicenseStatus.setText("");
                mTvDrivelicenseStatus.setLayoutParams(getLayoutParams(mTvDrivelicenseStatus));

                mTvCheckfileStatus.setBackgroundResource(R.drawable.loan_locked);
                mTvCheckfileStatus.setText("");
                mTvCheckfileStatus.setLayoutParams(getLayoutParams(mTvCheckfileStatus));

                mTvCarinfoStatus.setBackgroundResource(R.drawable.loan_locked);
                mTvCarinfoStatus.setText("");
                mTvCarinfoStatus.setLayoutParams(getLayoutParams(mTvCarinfoStatus));

                mTvContractStatus.setBackgroundResource(R.drawable.loan_locked);
                mTvContractStatus.setText("");
                mTvContractStatus.setLayoutParams(getLayoutParams(mTvContractStatus));

                mTvContactpeopleStatus.setBackgroundResource(R.drawable.loan_locked);
                mTvContactpeopleStatus.setText("");
                mTvContactpeopleStatus.setLayoutParams(getLayoutParams(mTvContactpeopleStatus));
                //平台下款回单
                mRlLoaninfoStatus.setVisibility(View.VISIBLE);
                mTvLoaninfoStatus.setBackgroundResource(R.drawable.loan_locked);
                mTvLoaninfoStatus.setText("");
                mTvLoaninfoStatus.setLayoutParams(getLayoutParams(mTvLoaninfoStatus));
                //退款回单
                mRlRefundStatus.setVisibility(View.VISIBLE);
                mTvRefundStatus.setBackgroundResource(R.drawable.loan_locked);
                mTvRefundStatus.setText("");
                mTvRefundStatus.setLayoutParams(getLayoutParams(mTvRefundStatus));
                break;
            case REFUND_CHECK_SUCCESSED:
                LogUtils.e("type:" + mType);
                mTvDrivelicenseStatus.setBackgroundResource(R.drawable.loan_locked);
                mTvDrivelicenseStatus.setText("");
                mTvDrivelicenseStatus.setLayoutParams(getLayoutParams(mTvDrivelicenseStatus));
                mTvCheckfileStatus.setBackgroundResource(R.drawable.loan_locked);
                mTvCheckfileStatus.setText("");
                mTvCheckfileStatus.setLayoutParams(getLayoutParams(mTvCheckfileStatus));
                mTvCarinfoStatus.setBackgroundResource(R.drawable.loan_locked);
                mTvCarinfoStatus.setText("");
                mTvCarinfoStatus.setLayoutParams(getLayoutParams(mTvCarinfoStatus));
                mTvContractStatus.setBackgroundResource(R.drawable.loan_locked);
                mTvContractStatus.setText("");
                mTvContractStatus.setLayoutParams(getLayoutParams(mTvContractStatus));
                mTvContactpeopleStatus.setBackgroundResource(R.drawable.loan_locked);
                mTvContactpeopleStatus.setText("");
                mTvContactpeopleStatus.setLayoutParams(getLayoutParams(mTvContactpeopleStatus));
                //平台下款回单
                mRlLoaninfoStatus.setVisibility(View.VISIBLE);
                mTvLoaninfoStatus.setBackgroundResource(R.drawable.loan_locked);
                mTvLoaninfoStatus.setText("");
                mTvLoaninfoStatus.setLayoutParams(getLayoutParams(mTvLoaninfoStatus));
                //退款回单
                mRlRefundStatus.setVisibility(View.VISIBLE);
                mTvRefundStatus.setBackgroundResource(R.drawable.loan_locked);
                mTvRefundStatus.setText("");
                mTvRefundStatus.setLayoutParams(getLayoutParams(mTvRefundStatus));
                break;
            case REFUND_REFUSED:
                LogUtils.e("type:" + mType);
                mTvDrivelicenseStatus.setBackgroundResource(R.drawable.loaninfo_completed);
                mTvDrivelicenseStatus.setText("");
                mTvDrivelicenseStatus.setLayoutParams(getLayoutParams(mTvDrivelicenseStatus));

                mTvCheckfileStatus.setBackgroundResource(R.drawable.loaninfo_completed);
                mTvCheckfileStatus.setText("");
                mTvCheckfileStatus.setLayoutParams(getLayoutParams(mTvCheckfileStatus));

                mTvCarinfoStatus.setBackgroundResource(R.drawable.loaninfo_completed);
                mTvCarinfoStatus.setText("");
                mTvCarinfoStatus.setLayoutParams(getLayoutParams(mTvCarinfoStatus));

                mTvContractStatus.setBackgroundResource(R.drawable.loaninfo_completed);
                mTvContractStatus.setText("");
                mTvContractStatus.setLayoutParams(getLayoutParams(mTvContractStatus));

                mTvContactpeopleStatus.setBackgroundResource(R.drawable.loaninfo_completed);
                mTvContactpeopleStatus.setText("");
                mTvContactpeopleStatus.setLayoutParams(getLayoutParams(mTvContactpeopleStatus));
                //平台下款回单
                mRlLoaninfoStatus.setVisibility(View.VISIBLE);
                mTvLoaninfoStatus.setBackgroundResource(R.drawable.loaninfo_completed);
                mTvLoaninfoStatus.setText("");
                mTvLoaninfoStatus.setLayoutParams(getLayoutParams(mTvLoaninfoStatus));
                //退款回单
                mRlRefundStatus.setVisibility(View.VISIBLE);
                mTvRefundStatus.setBackgroundResource(R.drawable.loan_uncompleted);
                mTvRefundStatus.setText("");
                mTvRefundStatus.setLayoutParams(getLayoutParams(mTvRefundStatus));
                break;
            /**
             * 解约的三种状态： 解约审核中 已解约 解约被拒绝
             */
            case BREAK_CHECKING:
                LogUtils.e("type:" + mType);
                mTvDrivelicenseStatus.setBackgroundResource(R.drawable.loan_locked);
                mTvDrivelicenseStatus.setText("");
                mTvDrivelicenseStatus.setLayoutParams(getLayoutParams(mTvDrivelicenseStatus));

                mTvCheckfileStatus.setBackgroundResource(R.drawable.loan_locked);
                mTvCheckfileStatus.setLayoutParams(getLayoutParams(mTvCheckfileStatus));
                mTvCheckfileStatus.setText("");

                mTvCarinfoStatus.setBackgroundResource(R.drawable.loan_locked);
                mTvCarinfoStatus.setLayoutParams(getLayoutParams(mTvCarinfoStatus));
                mTvCarinfoStatus.setText("");

                mTvContractStatus.setBackgroundResource(R.drawable.loan_locked);
                mTvContractStatus.setLayoutParams(getLayoutParams(mTvContractStatus));
                mTvContractStatus.setText("");
                mRlContractInfo.setClickable(false);

                mTvContactpeopleStatus.setBackgroundResource(R.drawable.loan_locked);
                mTvContactpeopleStatus.setLayoutParams(getLayoutParams(mTvContactpeopleStatus));
                mTvContactpeopleStatus.setText("");
                //平台下款回单
                mRlLoaninfoStatus.setVisibility(View.VISIBLE);
                mTvLoaninfoStatus.setBackgroundResource(R.drawable.loan_locked);
                mTvLoaninfoStatus.setLayoutParams(getLayoutParams(mTvLoaninfoStatus));
                mTvLoaninfoStatus.setText("");
                //放款回单
                mRlLoanmoneyStatus.setVisibility(View.VISIBLE);
                mTvLoanmoneyStatus.setBackgroundResource(R.drawable.loan_locked);
                mTvLoanmoneyStatus.setLayoutParams(getLayoutParams(mTvLoanmoneyStatus));
                mTvLoanmoneyStatus.setText("");
                //解约声明
                mRlBreakStatus.setVisibility(View.VISIBLE);
                mTvBreakStatus.setBackgroundResource(R.drawable.loan_locked);
                mTvBreakStatus.setLayoutParams(getLayoutParams(mTvBreakStatus));
                mTvBreakStatus.setText("");
                break;
            case BREAK_CHECK_SUCCESSED:
                LogUtils.e("type:" + mType);
                mTvDrivelicenseStatus.setBackgroundResource(R.drawable.loan_locked);
                mTvDrivelicenseStatus.setText("");
                mTvDrivelicenseStatus.setLayoutParams(getLayoutParams(mTvDrivelicenseStatus));

                mTvCheckfileStatus.setBackgroundResource(R.drawable.loan_locked);
                mTvCheckfileStatus.setLayoutParams(getLayoutParams(mTvCheckfileStatus));
                mTvCheckfileStatus.setText("");

                mTvCarinfoStatus.setBackgroundResource(R.drawable.loan_locked);
                mTvCarinfoStatus.setLayoutParams(getLayoutParams(mTvCarinfoStatus));
                mTvCarinfoStatus.setText("");

                mTvContractStatus.setBackgroundResource(R.drawable.loan_locked);
                mTvContractStatus.setLayoutParams(getLayoutParams(mTvContractStatus));
                mTvContractStatus.setText("");
                mRlContractInfo.setClickable(false);

                mTvContactpeopleStatus.setBackgroundResource(R.drawable.loan_locked);
                mTvContactpeopleStatus.setLayoutParams(getLayoutParams(mTvContactpeopleStatus));
                mTvContactpeopleStatus.setText("");
                //平台下款回单
                mRlLoaninfoStatus.setVisibility(View.VISIBLE);
                mTvLoaninfoStatus.setBackgroundResource(R.drawable.loan_locked);
                mTvLoaninfoStatus.setLayoutParams(getLayoutParams(mTvLoaninfoStatus));
                mTvLoaninfoStatus.setText("");
                //放款回单
                mRlLoanmoneyStatus.setVisibility(View.VISIBLE);
                mTvLoanmoneyStatus.setBackgroundResource(R.drawable.loan_locked);
                mTvLoanmoneyStatus.setLayoutParams(getLayoutParams(mTvLoanmoneyStatus));
                mTvLoanmoneyStatus.setText("");
                //解约声明
                mRlBreakStatus.setVisibility(View.VISIBLE);
                mTvBreakStatus.setBackgroundResource(R.drawable.loan_locked);
                mTvBreakStatus.setLayoutParams(getLayoutParams(mTvBreakStatus));
                mTvBreakStatus.setText("");
                break;
            case BREAK_REFUSED:
                LogUtils.e("type:" + mType);
                mTvDrivelicenseStatus.setBackgroundResource(R.drawable.loan_locked);
                mTvDrivelicenseStatus.setText("");
                mTvDrivelicenseStatus.setLayoutParams(getLayoutParams(mTvDrivelicenseStatus));

                mTvCheckfileStatus.setBackgroundResource(R.drawable.loan_locked);
                mTvCheckfileStatus.setLayoutParams(getLayoutParams(mTvCheckfileStatus));
                mTvCheckfileStatus.setText("");

                mTvCarinfoStatus.setBackgroundResource(R.drawable.loan_locked);
                mTvCarinfoStatus.setLayoutParams(getLayoutParams(mTvCarinfoStatus));
                mTvCarinfoStatus.setText("");

                mTvContractStatus.setBackgroundResource(R.drawable.loan_locked);
                mTvContractStatus.setLayoutParams(getLayoutParams(mTvContractStatus));
                mTvContractStatus.setText("");
                mRlContractInfo.setClickable(false);

                mTvContactpeopleStatus.setBackgroundResource(R.drawable.loan_locked);
                mTvContactpeopleStatus.setLayoutParams(getLayoutParams(mTvContactpeopleStatus));
                mTvContactpeopleStatus.setText("");
                //平台下款回单
                mRlLoaninfoStatus.setVisibility(View.VISIBLE);
                mTvLoaninfoStatus.setBackgroundResource(R.drawable.loan_locked);
                mTvLoaninfoStatus.setLayoutParams(getLayoutParams(mTvLoaninfoStatus));
                mTvLoaninfoStatus.setText("");
                //放款回单
                mRlLoanmoneyStatus.setVisibility(View.VISIBLE);
                mTvLoanmoneyStatus.setBackgroundResource(R.drawable.loan_locked);
                mTvLoanmoneyStatus.setLayoutParams(getLayoutParams(mTvLoanmoneyStatus));
                mTvLoanmoneyStatus.setText("");
                //解约声明
                mRlBreakStatus.setVisibility(View.VISIBLE);
                mTvBreakStatus.setBackgroundResource(R.drawable.loan_uncompleted);
                mTvBreakStatus.setLayoutParams(getLayoutParams(mTvBreakStatus));
                mTvBreakStatus.setText("");
                break;
            /**
             * 归档的三种状态： 归档审核中 已归档 归档被拒绝
             */
            case FILE_CHECKING:
                LogUtils.e("type:" + mType);
                mTvDrivelicenseStatus.setBackgroundResource(R.drawable.loan_locked);
                mTvDrivelicenseStatus.setText("");
                mTvDrivelicenseStatus.setLayoutParams(getLayoutParams(mTvDrivelicenseStatus));

                mTvCheckfileStatus.setBackgroundResource(R.drawable.loan_locked);
                mTvCheckfileStatus.setLayoutParams(getLayoutParams(mTvCheckfileStatus));
                mTvCheckfileStatus.setText("");

                mTvCarinfoStatus.setBackgroundResource(R.drawable.loan_locked);
                mTvCarinfoStatus.setLayoutParams(getLayoutParams(mTvCarinfoStatus));
                mTvCarinfoStatus.setText("");

                mTvContractStatus.setBackgroundResource(R.drawable.loan_locked);
                mTvContractStatus.setLayoutParams(getLayoutParams(mTvContractStatus));
                mTvContractStatus.setText("");
                mRlContractInfo.setClickable(false);

                mTvContactpeopleStatus.setBackgroundResource(R.drawable.loan_locked);
                mTvContactpeopleStatus.setLayoutParams(getLayoutParams(mTvContactpeopleStatus));
                mTvContactpeopleStatus.setText("");
                //平台下款回单
                mRlLoaninfoStatus.setVisibility(View.VISIBLE);
                mTvLoaninfoStatus.setBackgroundResource(R.drawable.loan_locked);
                mTvLoaninfoStatus.setLayoutParams(getLayoutParams(mTvLoaninfoStatus));
                mTvLoaninfoStatus.setText("");
                //放款回单
                mRlLoanmoneyStatus.setVisibility(View.VISIBLE);
                mTvLoanmoneyStatus.setBackgroundResource(R.drawable.loan_locked);
                mTvLoanmoneyStatus.setLayoutParams(getLayoutParams(mTvLoanmoneyStatus));
                mTvLoanmoneyStatus.setText("");
                break;
            case FILE_CHECK_SUCCESSED:
                LogUtils.e("type:" + mType);
                mTvDrivelicenseStatus.setBackgroundResource(R.drawable.loan_locked);
                mTvDrivelicenseStatus.setText("");
                mTvDrivelicenseStatus.setLayoutParams(getLayoutParams(mTvDrivelicenseStatus));

                mTvCheckfileStatus.setBackgroundResource(R.drawable.loan_locked);
                mTvCheckfileStatus.setLayoutParams(getLayoutParams(mTvCheckfileStatus));
                mTvCheckfileStatus.setText("");

                mTvCarinfoStatus.setBackgroundResource(R.drawable.loan_locked);
                mTvCarinfoStatus.setLayoutParams(getLayoutParams(mTvCarinfoStatus));
                mTvCarinfoStatus.setText("");

                mTvContractStatus.setBackgroundResource(R.drawable.loan_locked);
                mTvContractStatus.setLayoutParams(getLayoutParams(mTvContractStatus));
                mTvContractStatus.setText("");
                mRlContractInfo.setClickable(false);

                mTvContactpeopleStatus.setBackgroundResource(R.drawable.loan_locked);
                mTvContactpeopleStatus.setLayoutParams(getLayoutParams(mTvContactpeopleStatus));
                mTvContactpeopleStatus.setText("");
                //平台下款回单
                mRlLoaninfoStatus.setVisibility(View.VISIBLE);
                mTvLoaninfoStatus.setBackgroundResource(R.drawable.loan_locked);
                mTvLoaninfoStatus.setLayoutParams(getLayoutParams(mTvLoaninfoStatus));
                mTvLoaninfoStatus.setText("");
                //放款回单
                mRlLoanmoneyStatus.setVisibility(View.VISIBLE);
                mTvLoanmoneyStatus.setBackgroundResource(R.drawable.loan_locked);
                mTvLoanmoneyStatus.setLayoutParams(getLayoutParams(mTvLoanmoneyStatus));
                mTvLoanmoneyStatus.setText("");
                break;
            case FILE_REFUSED:
                LogUtils.e("type:" + mType);
                mTvDrivelicenseStatus.setBackgroundResource(R.drawable.loan_locked);
                mTvDrivelicenseStatus.setText("");
                mTvDrivelicenseStatus.setLayoutParams(getLayoutParams(mTvDrivelicenseStatus));

                mTvCheckfileStatus.setBackgroundResource(R.drawable.loan_locked);
                mTvCheckfileStatus.setLayoutParams(getLayoutParams(mTvCheckfileStatus));
                mTvCheckfileStatus.setText("");

                mTvCarinfoStatus.setBackgroundResource(R.drawable.loan_locked);
                mTvCarinfoStatus.setLayoutParams(getLayoutParams(mTvCarinfoStatus));
                mTvCarinfoStatus.setText("");

                mTvContractStatus.setBackgroundResource(R.drawable.loan_locked);
                mTvContractStatus.setLayoutParams(getLayoutParams(mTvContractStatus));
                mTvContractStatus.setText("");
                mRlContractInfo.setClickable(false);

                mTvContactpeopleStatus.setBackgroundResource(R.drawable.loan_locked);
                mTvContactpeopleStatus.setLayoutParams(getLayoutParams(mTvContactpeopleStatus));
                mTvContactpeopleStatus.setText("");
                //平台下款回单
                mRlLoaninfoStatus.setVisibility(View.VISIBLE);
                mTvLoaninfoStatus.setBackgroundResource(R.drawable.loan_locked);
                mTvLoaninfoStatus.setLayoutParams(getLayoutParams(mTvLoaninfoStatus));
                mTvLoaninfoStatus.setText("");
                //放款回单
                mRlLoanmoneyStatus.setVisibility(View.VISIBLE);
                mTvLoanmoneyStatus.setBackgroundResource(R.drawable.loan_uncompleted);
                mTvLoanmoneyStatus.setLayoutParams(getLayoutParams(mTvLoanmoneyStatus));
                mTvLoanmoneyStatus.setText("");
                break;
            /**
             * 续约的三种状态： 续约审核中 已续约 续约被拒绝
             */
            case RENEW_CHECKING:
                LogUtils.e("type:" + mType);
                mTvDrivelicenseStatus.setBackgroundResource(R.drawable.loan_locked);
                mTvDrivelicenseStatus.setText("");
                mTvDrivelicenseStatus.setLayoutParams(getLayoutParams(mTvDrivelicenseStatus));

                mTvCheckfileStatus.setBackgroundResource(R.drawable.loan_locked);
                mTvCheckfileStatus.setLayoutParams(getLayoutParams(mTvCheckfileStatus));
                mTvCheckfileStatus.setText("");

                mTvCarinfoStatus.setBackgroundResource(R.drawable.loan_locked);
                mTvCarinfoStatus.setLayoutParams(getLayoutParams(mTvCarinfoStatus));
                mTvCarinfoStatus.setText("");

                mTvContractStatus.setBackgroundResource(R.drawable.loan_locked);
                mTvContractStatus.setLayoutParams(getLayoutParams(mTvContractStatus));
                mTvContractStatus.setText("");
                mRlContractInfo.setClickable(false);

                mTvContactpeopleStatus.setBackgroundResource(R.drawable.loan_locked);
                mTvContactpeopleStatus.setLayoutParams(getLayoutParams(mTvContactpeopleStatus));
                mTvContactpeopleStatus.setText("");
                //平台下款回单
                mRlLoaninfoStatus.setVisibility(View.VISIBLE);
                mTvLoaninfoStatus.setBackgroundResource(R.drawable.loan_locked);
                mTvLoaninfoStatus.setLayoutParams(getLayoutParams(mTvLoaninfoStatus));
                mTvLoaninfoStatus.setText("");
                //放款回单
                mRlLoanmoneyStatus.setVisibility(View.VISIBLE);
                mTvLoanmoneyStatus.setBackgroundResource(R.drawable.loan_locked);
                mTvLoanmoneyStatus.setLayoutParams(getLayoutParams(mTvLoanmoneyStatus));
                mTvLoanmoneyStatus.setText("");
                //续约声明
                mRlRenewalStatus.setVisibility(View.VISIBLE);
                mTvRenewalStatus.setBackgroundResource(R.drawable.loan_locked);
                mTvRenewalStatus.setLayoutParams(getLayoutParams(mTvRenewalStatus));
                mTvRenewalStatus.setText("");
                break;
            case RENEW_CHECK_SUCCESSED:
                LogUtils.e("type:" + mType);
                mTvDrivelicenseStatus.setBackgroundResource(R.drawable.loan_locked);
                mTvDrivelicenseStatus.setText("");
                mTvDrivelicenseStatus.setLayoutParams(getLayoutParams(mTvDrivelicenseStatus));

                mTvCheckfileStatus.setBackgroundResource(R.drawable.loan_locked);
                mTvCheckfileStatus.setLayoutParams(getLayoutParams(mTvCheckfileStatus));
                mTvCheckfileStatus.setText("");

                mTvCarinfoStatus.setBackgroundResource(R.drawable.loan_locked);
                mTvCarinfoStatus.setLayoutParams(getLayoutParams(mTvCarinfoStatus));
                mTvCarinfoStatus.setText("");

                mTvContractStatus.setBackgroundResource(R.drawable.loan_locked);
                mTvContractStatus.setLayoutParams(getLayoutParams(mTvContractStatus));
                mTvContractStatus.setText("");
                mRlContractInfo.setClickable(false);

                mTvContactpeopleStatus.setBackgroundResource(R.drawable.loan_locked);
                mTvContactpeopleStatus.setLayoutParams(getLayoutParams(mTvContactpeopleStatus));
                mTvContactpeopleStatus.setText("");
                //平台下款回单
                mRlLoaninfoStatus.setVisibility(View.VISIBLE);
                mTvLoaninfoStatus.setBackgroundResource(R.drawable.loan_locked);
                mTvLoaninfoStatus.setLayoutParams(getLayoutParams(mTvLoaninfoStatus));
                mTvLoaninfoStatus.setText("");
                //放款回单
                mRlLoanmoneyStatus.setVisibility(View.VISIBLE);
                mTvLoanmoneyStatus.setBackgroundResource(R.drawable.loan_locked);
                mTvLoanmoneyStatus.setLayoutParams(getLayoutParams(mTvLoanmoneyStatus));
                mTvLoanmoneyStatus.setText("");
                //续约声明
                mRlRenewalStatus.setVisibility(View.VISIBLE);
                mTvRenewalStatus.setBackgroundResource(R.drawable.loan_locked);
                mTvRenewalStatus.setLayoutParams(getLayoutParams(mTvRenewalStatus));
                mTvRenewalStatus.setText("");
                break;
            case RENEW_REFUSED:
                LogUtils.e("type:" + mType);
                mTvDrivelicenseStatus.setBackgroundResource(R.drawable.loan_locked);
                mTvDrivelicenseStatus.setText("");
                mTvDrivelicenseStatus.setLayoutParams(getLayoutParams(mTvDrivelicenseStatus));

                mTvCheckfileStatus.setBackgroundResource(R.drawable.loan_locked);
                mTvCheckfileStatus.setLayoutParams(getLayoutParams(mTvCheckfileStatus));
                mTvCheckfileStatus.setText("");

                mTvCarinfoStatus.setBackgroundResource(R.drawable.loan_locked);
                mTvCarinfoStatus.setLayoutParams(getLayoutParams(mTvCarinfoStatus));
                mTvCarinfoStatus.setText("");

                mTvContractStatus.setBackgroundResource(R.drawable.loan_locked);
                mTvContractStatus.setLayoutParams(getLayoutParams(mTvContractStatus));
                mTvContractStatus.setText("");
                mRlContractInfo.setClickable(false);

                mTvContactpeopleStatus.setBackgroundResource(R.drawable.loan_locked);
                mTvContactpeopleStatus.setLayoutParams(getLayoutParams(mTvContactpeopleStatus));
                mTvContactpeopleStatus.setText("");
                //平台下款回单
                mRlLoaninfoStatus.setVisibility(View.VISIBLE);
                mTvLoaninfoStatus.setBackgroundResource(R.drawable.loan_locked);
                mTvLoaninfoStatus.setLayoutParams(getLayoutParams(mTvLoaninfoStatus));
                mTvLoaninfoStatus.setText("");
                //放款回单
                mRlLoanmoneyStatus.setVisibility(View.VISIBLE);
                mTvLoanmoneyStatus.setBackgroundResource(R.drawable.loan_locked);
                mTvLoanmoneyStatus.setLayoutParams(getLayoutParams(mTvLoanmoneyStatus));
                mTvLoanmoneyStatus.setText("");
                //续约声明
                mRlRenewalStatus.setVisibility(View.VISIBLE);
                mTvRenewalStatus.setBackgroundResource(R.drawable.loan_uncompleted);
                mTvRenewalStatus.setLayoutParams(getLayoutParams(mTvRenewalStatus));
                mTvRenewalStatus.setText("");
                break;
        }
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        EventBus.getDefault().unregister(this);
        //移除所有的粘性事件
        EventBus.getDefault().removeAllStickyEvents();
    }
}
